﻿namespace Com.OpenCode.DwgConvert.Model
{
    /// <summary>
    /// 执行进度事件代理委托
    /// </summary>
    /// <param name="args"></param>
    public delegate void DataConvertProcessDelegate(DataConvertProcessEventArgs args);

    /// <summary>
    /// 执行进度事件
    /// </summary>
    public class DataConvertProcessEventArgs : DataConvertEventArgs
    {
        private string description = "";

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataConvert"></param>
        /// <param name="percent"></param>
        /// <param name="description"></param>
        public DataConvertProcessEventArgs(IDataConvert dataConvert, double percent, string description)
            : base(dataConvert)
        {
            Percent = percent;
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataConvert"></param>
        /// <param name="percent"></param>
        public DataConvertProcessEventArgs(IDataConvert dataConvert, long current, double percent)
         : base(dataConvert)
        {
            Percent = percent;
            Current = current;
        }

        /// <summary>
        /// 执行的百分比
        /// </summary>
        public double Percent { get; set; } = 0.0;

        /// <summary>
        /// 当前执行都位置
        /// </summary>
        public long Current { get; set; }

        /// <summary>
        /// 任务执行描述信息
        /// </summary>
        public string Description
        {
            get
            {
                return string.Format("当前-{0}/共-{1}({2})", Current, DataConvert.InputDatasource.Count, Percent);
            }
            set
            {
                description = value;
            }
        }
    }
}